package com.sky.es.bean;

import com.sky.es.dto.CommentDTO;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Data
@Document(indexName = "newsindex")
public class NewsIndexTypeBean implements Serializable {
    @Id
    private Integer id;
    @Field(type = FieldType.Keyword)
    private String title;
    @Field(type = FieldType.Date)
    private Date createDate;
    @Field(type = FieldType.Keyword)
    private String author;
    @Field(type = FieldType.Text)
    private String content;
    @Field(type = FieldType.Nested)
    private List<CommentDTO> comments;
}
